import logging
import os

WORK_DIR = os.path.dirname(__file__)

PRJ_NAME = 'ai_learning'


def init_log():
    logger = logging.getLogger(PRJ_NAME)
    logger.setLevel(logging.INFO)

    fh = logging.FileHandler('%s/%s.log' % (WORK_DIR, PRJ_NAME), mode='w')
    fh.setLevel(logging.INFO)

    formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
    fh.setFormatter(formatter)

    logger.addHandler(fh)
    return logger


LOGGER = init_log()
